/*
 * #%L
 * java model
 * %%
 * Copyright (C) 2009 - 2011 Stefan Isele
 * %%
 * All Rights Reserved.
 * This program is dual-licensed under the GNU General Public license
 * or a commercial license.
 * You may select to use one or the other of these licenses.
 * To obtain a commercial license please contact Stefan Isele at www.stefan-isele.de
 * Any modifications to this file must keep this entire header intact.
 * Redistribution, except as permitted by the selected license, is prohibited.
 * #L%
 */
package com.prefabware.jmodel;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * a type with actual type paramaters
 * used to combine the raw type and the type parameters for
 * a JMember
 * @see java.lang.reflect.ParameterizedType
 * @author sisele_job
 *
 */
public class JParameterizedType {
	
	private JType type;
	private List<JType> typeArguments;

	public JParameterizedType(JType type, JType... types) {
		super();
		this.type = type;
		if (types == null || types.length == 0) {
			this.typeArguments = Collections.emptyList();
		} else {
			this.typeArguments = Arrays.asList(types);
		}
	}

	/**
	 * the generic type e.g. java.util.List
	 * @return
	 */
	public JType getRawType() {
		return type;
	}

	/**
	 * @return the type parameters e.g. String for List<String>
	 */
	public List<JType> getTypeArguments() {
		return typeArguments;
	}

}